import java.util.Arrays;

public class JavaSort {

    public static int[] args = {23, 33, 11, 67, 44, 33, 99};

    public static void main(String[] args) {
        bubbleSorting();
        selectSorting();
    }

    public static void bubbleSorting() {
        System.out.println(Arrays.toString(args).trim());
        for (int i = 0; i < args.length; i++) {
            for (int j = 0; j < args.length - i - 1; j++) {
                if (args[j] > args[j + 1]) {
                    int temp = args[j];
                    args[j] = args[j + 1];
                    args[j + 1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(args).trim());
    }

    public static void selectSorting() {
        System.out.println(Arrays.toString(args).trim());
        int minIndex, temp;
        for (int i = 0; i < args.length -1 ; i++) {
            minIndex = i;
            for (int j = i; j <args.length ; j++) {
                if (args[j] < args[minIndex]) {
                    minIndex = j;
                }
            }
            temp = args[minIndex];
            args[minIndex] = args[i];
            args[i] = temp;
        }
        System.out.println(Arrays.toString(args).trim());
    }
}
